package com.avic.rong.search.adapter.homePageAdapter;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.avic.rong.BaseActivity;
import com.avic.rong.R;
import com.avic.rong.activity.ArticleDetailActivity;
import com.avic.rong.activity.VideoDetailActivity;
import com.avic.rong.activity.product.DetailProductActivity;
import com.avic.rong.bean.product.GoodBean;
import com.avic.rong.bean.show_bean.DetailBean;
import com.avic.rong.bean.show_bean.EsInfoBean;
import com.avic.rong.course.activity.CourseDetailActivity;
import com.avic.rong.fragment.showapi.DetailApi;
import com.avic.rong.utils.ConstantsUtils;
import com.avic.rong.utils.DensityUtils;
import com.avic.rong.utils.GlideUtils;
import com.avic.rong.utils.StringUtils;
import com.bumptech.glide.Glide;
import com.bumptech.glide.Priority;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.example.minato.minastore.BaseResultEntity;
import com.example.minato.minastore.http.HttpManager;
import com.example.minato.minastore.listener.HttpOnNextListener;
import com.example.minato.minastore.utils.AppUtils;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.orhanobut.logger.Logger;
import com.trello.rxlifecycle2.components.support.RxAppCompatActivity;

import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Chenjiaxin on 2019/7/20 12:55
 * E-Mail Address：16601203965@163.com
 */
public class SearchAllAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

    private Context context;
    private List<GoodBean> beanList = new ArrayList<>();
    private CartAddListener cartAddListener;
    private int standardType = 1;//1.标准 2.商品  3.培训  4.文章  5.成果转化
    private Map<Integer, EsInfoBean> esInfoBeanMap = new HashMap<>();//浏览数量附属信息
    private String keyword;

    public void setKeyword(String keyword) {
        if (TextUtils.isEmpty(keyword)){
            this.keyword =  "";
        }
        this.keyword = keyword;
    }

    public void addEsList(List<EsInfoBean> esList) {
        for (EsInfoBean temp : esList) {
            esInfoBeanMap.put(temp.getCont_id(), temp);
        }
    }

    public void clearEsList() {
        esInfoBeanMap.clear();
    }

    public void setStandardType(int standardType) {
        this.standardType = standardType;
    }

    public void setCartAddListener(CartAddListener cartAddListener) {
        this.cartAddListener = cartAddListener;
    }

    public SearchAllAdapter(Context context) {
        this.context = context;
    }

    public void setBeanList(List<GoodBean> beanList) {
        this.beanList = beanList;
        notifyDataSetChanged();
    }


    @NonNull
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int type) {
        View view = null;
        if (type == 1) {
            view = LayoutInflater.from(context).inflate(R.layout.item_view_standard_two, viewGroup, false);
            return new StandardItemViewHolder(view);
        } else if (type == 2) {
            view = LayoutInflater.from(context).inflate(R.layout.item_view_book_two, viewGroup, false);
            return new BookItemViewHolder(view);
        } else if (type == 3) {
            view = LayoutInflater.from(context).inflate(R.layout.item_course_index_two, viewGroup, false);
            return new CultivateViewHolder(view);
        } else if (type == 4) {
            view = LayoutInflater.from(context).inflate(R.layout.anli_item_all, viewGroup, false);
            return new ArticleViewHolder(view);
        } else if (type == 5) {
            view = LayoutInflater.from(context).inflate(R.layout.anli_item_all, viewGroup, false);
            return new ArticleViewHolder(view);
        } else if (type == 100) {
            view = LayoutInflater.from(context).inflate(R.layout.item_view_title, viewGroup, false);
            return new TitleViewHolder(view);
        } else {
            view = LayoutInflater.from(context).inflate(R.layout.anli_item_all, viewGroup, false);
            return new ArticleViewHolder(view);
        }
    }

    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, final int positon) {


        GoodBean bean = beanList.get(positon);
        if (bean.getTypeFlag() == 1) {// 标准
            StandardItemViewHolder standardItemViewHolder = (StandardItemViewHolder) holder;

            if (bean.isLastOne()) {
                standardItemViewHolder.line.setVisibility(View.GONE);
            } else {
                standardItemViewHolder.line.setVisibility(View.VISIBLE);
            }

            String standardNo = "";
            if (!StringUtils.isEmpty(bean.getNo())) {
                standardNo = bean.getNo();
            }

            SpannableString spannableString = new SpannableString(bean.getTitle());
            int startIndex = bean.getTitle().indexOf(keyword);
            if (startIndex >= 0) {
                ForegroundColorSpan colorSpan = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_f23030));
                spannableString.setSpan(colorSpan, startIndex, startIndex + keyword.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
                standardItemViewHolder.tv_standard_name.setText(spannableString.toString().replaceFirst(Pattern.quote(standardNo), ConstantsUtils.EMPTY_STR).trim());
            } else {
                standardItemViewHolder.tv_standard_name.setText(bean.getTitle().replaceFirst(Pattern.quote(standardNo), ConstantsUtils.EMPTY_STR).trim());
            }
//            standardItemViewHolder.tv_standard_name.setText(bean.getTitle().replaceFirst(Pattern.quote(standardNo), ConstantsUtils.EMPTY_STR).trim());

            DecimalFormat df = new DecimalFormat("###0.00");
            String format = df.format(bean.getPrice());

//            String time = bean.getPostTime();
//            String newTime = time.substring(0, time.indexOf("T"));
            if (StringUtils.isEmpty(bean.getAttrShow())) {
                standardItemViewHolder.tv_standard_status.setVisibility(View.GONE);
            } else {
                standardItemViewHolder.tv_standard_status.setVisibility(View.VISIBLE);
                standardItemViewHolder.tv_standard_status.setText(bean.getAttrShow());
            }

            standardItemViewHolder.tv_standard_no.setText(bean.getNo());

            String publishDate = "";
            String implDate = "";
            List<String> attrsList = bean.getAttrs();
            for (String attr : attrsList) {
                if (!StringUtils.isEmpty(attr)) {
                    if (attr.contains("60|") && attr.length() > 3) {
                        publishDate = attr.substring(3);
                    } else if (attr.contains("61|") && attr.length() > 3) {
                        implDate = attr.substring(3);
                    }
                }
            }
            standardItemViewHolder.tv_standard_publish_time.setText("发布日期:  " + publishDate);
            standardItemViewHolder.tv_standard_impl_time.setText("实施日期:  " + implDate);
            standardItemViewHolder.tv_standard_price.setText("¥" + format);

            standardItemViewHolder.itemView.setOnClickListener(new MyClickListener(standardItemViewHolder, bean));
            //添加购物车
            standardItemViewHolder.img_shop_car.setOnClickListener(new MyClickListener(standardItemViewHolder, bean));


        } else if (bean.getTypeFlag() == 2) {//商品

            BookItemViewHolder bookItemViewHolder = (BookItemViewHolder) holder;
            if (bean.isLastOne()) {
                bookItemViewHolder.view_line.setVisibility(View.INVISIBLE);
            } else {
                bookItemViewHolder.view_line.setVisibility(View.VISIBLE);
            }
            //设置头部padding-top
            RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) bookItemViewHolder.ll_group_out.getLayoutParams();
            if (positon == 0) {
                layoutParams.topMargin = DensityUtils.dp2px(context, 10);
            } else {
                layoutParams.topMargin = 0;
            }
            bookItemViewHolder.ll_group_out.setLayoutParams(layoutParams);


            String standardNo = "";
            if (!StringUtils.isEmpty(bean.getNo())) {
                standardNo = bean.getNo();
            }



            SpannableString spannableString = new SpannableString(bean.getTitle());
            int startIndex = bean.getTitle().indexOf(keyword);
            if (startIndex >= 0) {
                ForegroundColorSpan colorSpan = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_f23030));
                spannableString.setSpan(colorSpan, startIndex, startIndex + keyword.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
                bookItemViewHolder.tv_standard_name.setText(spannableString.toString().replaceFirst(Pattern.quote(standardNo), ConstantsUtils.EMPTY_STR).trim());
            } else {
                bookItemViewHolder.tv_standard_name.setText(bean.getTitle().replaceFirst(Pattern.quote(standardNo), ConstantsUtils.EMPTY_STR).trim());
            }

//            bookItemViewHolder.tv_standard_name.setText(bean.getTitle().replaceFirst(standardNo, ConstantsUtils.EMPTY_STR).trim());

            if (StringUtils.isEmpty(bean.getAttrShow())) {
                bookItemViewHolder.tv_standard_status.setVisibility(View.INVISIBLE);
            } else {
                bookItemViewHolder.tv_standard_status.setVisibility(View.VISIBLE);
                bookItemViewHolder.tv_standard_status.setText(bean.getAttrShow());
            }

            bookItemViewHolder.tv_standard_no.setText(bean.getNo());
            bookItemViewHolder.tv_standard_category.setText(bean.getTitle());

            bookItemViewHolder.tv_book_desc_sub.setVisibility(View.VISIBLE);
            if (bean.getTypeId() == 2) {//图书
                String author = "";
                String publisDept = "";
                List<String> attrsList = bean.getAttrs();
                for (String attr : attrsList) {
                    if (!StringUtils.isEmpty(attr)) {
                        if (attr.contains("91|") && attr.length() > 3) {
                            author = attr.substring(3);
                        } else if (attr.contains("95|") && attr.length() > 3) {
                            publisDept = attr.substring(3);
                        }
                    }
                }
                bookItemViewHolder.tv_book_desc.setMaxLines(1);
                bookItemViewHolder.tv_book_desc.setText("作者:  " + author);
                bookItemViewHolder.tv_book_desc_sub.setMaxLines(1);
                bookItemViewHolder.tv_book_desc_sub.setText("出版社:  " + publisDept);

            } else if (bean.getTypeId() == 4) {//实用文档
                String author = "";
                String publisDept = "";
                List<String> attrsList = bean.getAttrs();
                for (String attr : attrsList) {
                    if (!StringUtils.isEmpty(attr)) {
                        if (attr.contains("169|") && attr.length() > 3) {
                            author = attr.substring(3);
                        } else if (attr.contains("171|") && attr.length() > 3) {
                            publisDept = attr.substring(3);
                        }
                    }
                }
                bookItemViewHolder.tv_standard_category.setText(bean.getTempName());
                bookItemViewHolder.tv_book_desc.setMaxLines(1);
                bookItemViewHolder.tv_book_desc.setText("主编单位:  " + author);
                bookItemViewHolder.tv_book_desc_sub.setMaxLines(1);
                bookItemViewHolder.tv_book_desc_sub.setText("最新修订日期:  " + publisDept);
            } else {
                if (bean.getDesc() != null) {
                    bookItemViewHolder.tv_book_desc.setText(Html.fromHtml(bean.getDesc()));
                    bookItemViewHolder.tv_book_desc.setMaxLines(2);
                } else {
                    bookItemViewHolder.tv_book_desc.setText("");
                }
                bookItemViewHolder.tv_book_desc_sub.setVisibility(View.GONE);
            }

            DecimalFormat df = new DecimalFormat("###0.00");
            String format = df.format(bean.getPrice());
            bookItemViewHolder.tv_standard_price.setText("¥" + format);

            String imgUrl = bean.getImg();
            if (StringUtils.isEmpty(imgUrl)) {
                if (bean.getTypeId() == 2) {//图书
                    bookItemViewHolder.ll_no_picture.setVisibility(View.GONE);
                    bookItemViewHolder.tv_standard_status.setVisibility(View.GONE);
                    bookItemViewHolder.img_picture.setBackground(ContextCompat.getDrawable(context, R.mipmap.doc_default));
                } else {
                    bookItemViewHolder.ll_no_picture.setVisibility(View.VISIBLE);
                    bookItemViewHolder.tv_standard_status.setVisibility(View.VISIBLE);
                }
            } else {
                if (!imgUrl.contains(".rongrong")) {
                    imgUrl = AppUtils.IMG2_URL + imgUrl;
                }
                bookItemViewHolder.ll_no_picture.setVisibility(View.GONE);
                bookItemViewHolder.tv_standard_status.setVisibility(View.GONE);

                RequestOptions options = new RequestOptions()
                        .centerCrop()
                        .placeholder(R.mipmap.doc_default)
                        .error(R.mipmap.doc_default)
                        .dontAnimate()
                        .skipMemoryCache(false)
                        .transform(new CenterCrop(), new RoundedCorners(DensityUtils.dp2px(context, 4f)))
                        .priority(Priority.NORMAL);

                Glide.with(context).load(imgUrl)
                        .apply(options)
                        .override(DensityUtils.dp2px(context, 115), DensityUtils.dp2px(context, 115))
                        .into(bookItemViewHolder.img_picture);
            }


            bookItemViewHolder.itemView.setOnClickListener(new MyClickListener(bookItemViewHolder, bean));
            //添加购物车
            if (standardType == 3 || standardType == 4 || standardType == 5) {//5：解决方案
                bookItemViewHolder.img_shop_car.setVisibility(View.GONE);
            } else {
                bookItemViewHolder.img_shop_car.setVisibility(View.VISIBLE);
            }
            bookItemViewHolder.img_shop_car.setOnClickListener(new MyClickListener(bookItemViewHolder, bean));


        } else if (bean.getTypeFlag() == 3) {//培训

            CultivateViewHolder cultivateViewHolder = (CultivateViewHolder) holder;
            if (bean.isLastOne()) {
                cultivateViewHolder.line.setVisibility(View.INVISIBLE);
            } else {
                cultivateViewHolder.line.setVisibility(View.VISIBLE);
            }
            String type = StringUtils.getParamByUrl(bean.getUrl(), "type");
            if ((bean.getCatIds() != null && Integer.valueOf(2).equals(bean.getCatIds().get(0))) || (type != null && "2".equals(type))) {  //线下课程
                if (bean.getPrice() > 0) {
                    cultivateViewHolder.tv_course_price.setText("¥" + bean.getPrice());
                } else {
                    cultivateViewHolder.tv_course_price.setText("");
                }

                if (!TextUtils.isEmpty(bean.getAttrShow())) {
                    JsonParser parser = new JsonParser();
                    JsonObject jsonElement = (JsonObject) parser.parse(bean.getAttrShow());
                    String city = jsonElement.get("city").getAsString();
                    String startTime = jsonElement.get("startTime").getAsString();
                    if (!TextUtils.isEmpty(startTime))
                        cultivateViewHolder.tv_course_total_time.setText("开课时间：" + startTime.split(" ")[0]);
                    cultivateViewHolder.tv_course_time.setText("开课地点：" + city);//online_default
                }

                GlideUtils.loaderHanldeRoundImage(context, bean.getImg(), cultivateViewHolder.img_course_logo, R.mipmap.offline_default, DensityUtils.dp2px(context, 6));

            } else {
                if (bean.getPrice() > 0) {
                    cultivateViewHolder.tv_course_price.setText("¥" + bean.getPrice());
                } else {
                    cultivateViewHolder.tv_course_price.setText("");
                }
                if (!TextUtils.isEmpty(bean.getAttrShow())) {
                    JsonParser parser = new JsonParser();
                    JsonObject jsonElement = (JsonObject) parser.parse(bean.getAttrShow());
                    String coursesHourCount = jsonElement.get("coursesHourCount").getAsString();
                    String courseTotalTime = jsonElement.get("courseTotalTime").getAsString();

                    if (TextUtils.isEmpty(coursesHourCount)) {
                        cultivateViewHolder.tv_course_total_time.setText("课时：暂未详细课时");
                    } else {
                        cultivateViewHolder.tv_course_total_time.setText("课时：" + coursesHourCount + "课时");
                    }
                    if (TextUtils.isEmpty(courseTotalTime)) {
                        cultivateViewHolder.tv_course_time.setText("时长：暂无详细时长");
                    } else {
                        cultivateViewHolder.tv_course_time.setText("时长：" + coursesHourCount);
                    }
                }

                GlideUtils.loaderHanldeRoundImage(context, bean.getImg(), cultivateViewHolder.img_course_logo, R.mipmap.online_default, DensityUtils.dp2px(context, 6));
            }
//            cultivateViewHolder.tv_course_name.setText(bean.getTitle());

            SpannableString spannableString = new SpannableString(bean.getTitle());
            int startIndex = bean.getTitle().toLowerCase().indexOf(keyword.toLowerCase());
            if (startIndex >= 0) {
                ForegroundColorSpan colorSpan = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_f23030));
                spannableString.setSpan(colorSpan, startIndex, startIndex + keyword.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
                cultivateViewHolder.tv_course_name.setText(spannableString);
            } else {
                cultivateViewHolder.tv_course_name.setText(bean.getTitle());
            }


        } else if (bean.getTypeFlag() == 4) {//文章
            ArticleViewHolder articleViewHolder = (ArticleViewHolder) holder;
            if (!TextUtils.isEmpty(bean.getImg())) {
                articleViewHolder.img_cover.setVisibility(View.VISIBLE);
                Glide.with(context).load(bean.getImg()).apply(RequestOptions.bitmapTransform(new RoundedCorners(1))).placeholder(R.mipmap.doc_default).error(R.mipmap.doc_default).into(articleViewHolder.img_cover);
            } else if (!TextUtils.isEmpty(bean.getCoverImgOne())) {
                articleViewHolder.img_cover.setVisibility(View.VISIBLE);
                Glide.with(context).load(bean.getCoverImgOne()).apply(RequestOptions.bitmapTransform(new RoundedCorners(1))).placeholder(R.mipmap.doc_default).error(R.mipmap.doc_default).into(articleViewHolder.img_cover);
            } else if (!TextUtils.isEmpty(bean.getCoverImgTwo())) {
                articleViewHolder.img_cover.setVisibility(View.VISIBLE);
                Glide.with(context).load(bean.getCoverImgTwo()).apply(RequestOptions.bitmapTransform(new RoundedCorners(1))).placeholder(R.mipmap.doc_default).error(R.mipmap.doc_default).into(articleViewHolder.img_cover);
            } else {
                articleViewHolder.img_cover.setVisibility(View.GONE);
            }
//            articleViewHolder.tv_title.setText(bean.getTitle());

            SpannableString spannableString = new SpannableString(bean.getTitle());
            int startIndex = bean.getTitle().toLowerCase().indexOf(keyword.toLowerCase());
            if (startIndex >= 0) {
                ForegroundColorSpan colorSpan = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_f23030));
                spannableString.setSpan(colorSpan, startIndex, startIndex + keyword.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
                articleViewHolder.tv_title.setText(spannableString);
            } else {
                articleViewHolder.tv_title.setText(bean.getTitle());
            }



            articleViewHolder.tv_time.setText(bean.getPostTime());

            if (esInfoBeanMap.get(bean.getDataId()) != null) {
                articleViewHolder.tv_author.setText(esInfoBeanMap.get(bean.getDataId()).getAuthor());
                articleViewHolder.tv_view_num.setText(esInfoBeanMap.get(bean.getDataId()).getView_num() + "阅读");
//                Glide.with(context).load(esInfoBeanMap.get(bean.getDataId()).getLogo()).transform(new GlideCircleTransform(context)).placeholder(R.mipmap.ic_default_head).error(R.mipmap.ic_default_head).fitCenter().into(articleViewHolder.logo);
                RequestOptions requestOptions = new RequestOptions().error(R.mipmap.ic_default_head).circleCrop();
                Glide.with(context).applyDefaultRequestOptions(requestOptions).load(esInfoBeanMap.get(bean.getDataId()).getLogo()).into(articleViewHolder.logo);
            }

        } else if (bean.getTypeFlag() == 100) {
            TitleViewHolder titleViewHolder = (TitleViewHolder) holder;
            titleViewHolder.tv_title.setText(bean.getTypeName());
        }

        if (bean.getTypeFlag() != 100) {
            holder.itemView.setOnClickListener(new MyClickListener(holder, bean));
        }
    }

    @Override
    public int getItemCount() {
        return beanList.size();
    }


    @Override
    public int getItemViewType(int position) {
        return beanList.get(position).getTypeFlag();
    }

    class MyClickListener implements View.OnClickListener {
        RecyclerView.ViewHolder holder;
        GoodBean bean;

        public MyClickListener(RecyclerView.ViewHolder holder, GoodBean bean) {
            this.holder = holder;
            this.bean = bean;
        }

        @Override
        public void onClick(View v) {
            int viewId = v.getId();
            String s = bean.getUrl();
            String[] split = s.split("/");
            Logger.e("cjx", "splite:" + split[2]);
            if (viewId == R.id.img_shop_car) {//添加购物车
                if (cartAddListener != null) {
                    if (holder instanceof StandardItemViewHolder) {
                        cartAddListener.addCar(Integer.parseInt(split[2]), ((StandardItemViewHolder) holder).img_shop_car);
                    } else {
                        cartAddListener.addCar(Integer.parseInt(split[2]), ((BookItemViewHolder) holder).img_shop_car);
                    }
                }

            } else {
                if (bean.getTypeFlag() == 1 || bean.getTypeFlag() == 2) {// 1.标准 2.商品  3.培训  4.文章  5.成果转化
                    String skuStr = bean.getUrl();
                    ((BaseActivity) context).startActivity(DetailProductActivity.getIntent(context, skuStr.substring(skuStr.lastIndexOf("/"))));
                } else if (bean.getTypeFlag() == 3) {
                    String courseId = StringUtils.getParamByUrl(bean.getUrl(), "type") + bean.getDataId();
                    ((BaseActivity) context).startActivity(CourseDetailActivity.getIntent(context, courseId, bean.getImg(), bean.getTitle()));
                } else if (bean.getTypeFlag() == 4) {
                    //内容详情z
                    DetailApi detailApi = new DetailApi((RxAppCompatActivity) context, DetailhttpOnNextListener, "", bean.getDataId() + "");
                    detailApi.setCache(false);
                    HttpManager.getInstance().doHttpDeal(detailApi);
                }

//                ((BaseActivity) context).startActivityForResult(DetailProductActivity.getIntent(context, split[2]), GoodsSortBzActivity.CODE_REQUEST);
            }

        }

        //内容详情
        HttpOnNextListener<BaseResultEntity> DetailhttpOnNextListener = new HttpOnNextListener<BaseResultEntity>() {
            @Override
            public void onNext(BaseResultEntity baseResultEntity) {
                String code = baseResultEntity.getCode();
                if (code.equals("200")) {
                    DetailBean detailBean = (DetailBean) baseResultEntity.getData();
                    List<DetailBean.OtherInfoBean> otherInfo = detailBean.getOtherInfo();
                    if (5 == otherInfo.get(0).getTypeFlg()) {
                        ((BaseActivity) context).startActivity(VideoDetailActivity.getIntent(context, String.valueOf(bean.getDataId())));

                    } else {
                        ((BaseActivity) context).startActivity(ArticleDetailActivity.getIntent(context, String.valueOf(bean.getDataId())));
                    }


                }

            }

        };
    }


    public static class StandardItemViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.tv_standard_status)
        TextView tv_standard_status;
        @BindView(R.id.tv_standard_price)
        TextView tv_standard_price;
        @BindView(R.id.tv_standard_no)
        TextView tv_standard_no;
        @BindView(R.id.tv_standard_name)
        TextView tv_standard_name;
        @BindView(R.id.img_shop_car)
        public ImageView img_shop_car;
        @BindView(R.id.tv_standard_publish_time)
        TextView tv_standard_publish_time;
        @BindView(R.id.tv_standard_impl_time)
        TextView tv_standard_impl_time;
        @BindView(R.id.line)
        View line;


        public StandardItemViewHolder(@NonNull View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }

    public static class BookItemViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.tv_standard_status)
        TextView tv_standard_status;
        @BindView(R.id.tv_standard_price)
        TextView tv_standard_price;
        @BindView(R.id.tv_standard_no)
        TextView tv_standard_no;
        @BindView(R.id.tv_standard_name)
        TextView tv_standard_name;
        @BindView(R.id.img_shop_car)
        public ImageView img_shop_car;
        @BindView(R.id.tv_book_desc)
        TextView tv_book_desc;
        @BindView(R.id.img_picture)
        ImageView img_picture;//图片
        @BindView(R.id.ll_no_picture)
        LinearLayout ll_no_picture;
        @BindView(R.id.tv_standard_category)
        TextView tv_standard_category;//分类
        @BindView(R.id.tv_book_desc_sub)
        TextView tv_book_desc_sub;

        @BindView(R.id.ll_group_out)
        LinearLayout ll_group_out;//最外面布局

        @BindView(R.id.view_line)
        View view_line;


        public BookItemViewHolder(@NonNull View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }


    public class ArticleViewHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.tv_title)
        TextView tv_title;
        @BindView(R.id.tv_author)
        TextView tv_author;
        @BindView(R.id.img_cover)
        ImageView img_cover;
        @BindView(R.id.logo)
        ImageView logo;
        @BindView(R.id.tv_view_num)
        TextView tv_view_num;
        @BindView(R.id.tv_time)
        TextView tv_time;

        public ArticleViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }

    }

    public class CultivateViewHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.img_course_logo)
        ImageView img_course_logo;
        @BindView(R.id.tv_course_name)
        TextView tv_course_name;
        @BindView(R.id.tv_course_total_time)
        TextView tv_course_total_time;
        @BindView(R.id.tv_course_time)
        TextView tv_course_time;
        @BindView(R.id.tv_course_price)
        TextView tv_course_price;
        @BindView(R.id.line)
        View line;

        public CultivateViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }

    public class TitleViewHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.tv_title)
        TextView tv_title;
        @BindView(R.id.tv_more)
        TextView tv_more;

        public TitleViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }


    public interface CartAddListener {
        void addCar(int skuId, ImageView cartImageView);
    }
}
